/*
 * @lc app=leetcode.cn id=2124 lang=typescript
 *
 * [2124] 检查是否所有 A 都在 B 之前
 */

// @lc code=start
function checkString(s: string): boolean {
    let end = false;
    for (let i = 0; i < s.length; i++) {
        const element = s[i];
        if (element === "b" && !end) {
            end = true;
        }
        if (end && element === "a") {
            return false;
        }
    }
    return true;
}
// @lc code=end
